(* stack.pp *)

unit stack;

interface
uses nodes;
procedure push(a: node);
function pop() : node;

implementation

procedure push(a: node);
var
   t : link ;
   x : info;
begin
   x := a.item;
   new(t);
   t^.item := x;
   t^.next := top;
   top := t;
end; { push }

function pop() : node;
var
   t : link;
   a : node;
begin
   a.item := top^.item;
   a.next := top^.next;
   t := top^.next;
   top := t;
   pop := a;
end; { pop }
   
end.
